import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
import ParentView from '@/components/ParentView';

/**
 * Note: 路由配置项
 *
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true               // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'             // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    noCache: true                // 如果设置为true，则不会被 <keep-alive> 缓存(默认 false)
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
  }
 */

// 公共路由
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: (resolve) => require(['@/views/redirect'], resolve)
      },
    ]
  },
  {
    path: '/login',
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/Notification',
    component: (resolve) => require(['@/views/MessageNotification'], resolve),
    hidden: true
  },{
    path: '/help',
    component: (resolve) => require(['@/views/help'], resolve),
    hidden: true
  },
  {
    path: '/ResourceCalculator',
    component: (resolve) => require(['@/views/ResourceCalculator'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/error/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/error/401'], resolve),
    hidden: true
  },
  {
    path: '',
    component: Layout,
    redirect: 'index',
    children: [
      {
        path: 'index',
        component: (resolve) => require(['@/views/index'], resolve),
        name: '首页',
        meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
      },
    ]
  },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'profile',
        component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
        name: 'Profile',
        meta: { title: '个人中心', icon: 'user' }
      },
    ]
  },
  {
    path: '/dict',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:dictId(\\d+)',
        component: (resolve) => require(['@/views/system/dict/data'], resolve),
        name: 'Data',
        meta: { title: '字典数据', icon: '' }
      }
    ]
  },
  {
    path: '/job',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'log',
        component: (resolve) => require(['@/views/monitor/job/log'], resolve),
        name: 'JobLog',
        meta: { title: '调度日志' }
      }
    ]
  },
  {
    path: '/gen',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'edit/:tableId(\\d+)',
        component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
        name: 'GenEdit',
        meta: { title: '修改生成配置' }
      }
    ]
  },
  {
    path: '/resources/applys',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'Detailsindex/:Id',
        component: (resolve) => require(['@/views/resources/apply/Detailsindex'], resolve),
        name: 'Detailsindex',
        meta: { title: '信创资源申请详情' }
      }
    ]
  },
  {
    path: '/resources/applyNoXc',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'Detailsindex/:Id',
        component: (resolve) => require(['@/views/resources/applyNoXc/Detailsindex'], resolve),
        name: 'DetailsindexNoXc',
        meta: { title: '非信创资源申请详情' }
      }
    ]
  },
  {
    path: '/resources/applys',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'addapply',
        component: (resolve) => require(['@/views/resources/apply/addapply'], resolve),
        name: 'addapply',
        meta: { title: '信创资源申请' }
      }
    ]
  },
  {
    path: '/resources/applyNoXc',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'addapply',
        component: (resolve) => require(['@/views/resources/applyNoXc/addapply'], resolve),
        name: 'applyNoXc',
        meta: { title: '非信创资源申请' }
      }
    ]
  },
  {
    path: '/clouds',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'AddCloudSystem',
        component: (resolve) => require(['@/views/cloud/AddCloudSystem'], resolve),
        name: 'AddCloudSystem',
        meta: { title: '申请上云系统' }
      }
    ]
  },
  {
    path: '/clouds/cloudapply',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'AddCloudSystem',
        component: (resolve) => require(['@/views/cloud/cloudapply/AddCloudSystem'], resolve),
        name: 'AddCloudSystemss',
        meta: { title: '申请上云系统' }
      }
    ]
  },
  {
    path: '/cloud',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/cloud/cloudapply/details'], resolve),
        name: 'details',
        meta: { title: '上云系统详情' }
      }
    ]
  },
  {
    path: '/clouds/projectmanage',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'AddCloudSystems',
        component: (resolve) => require(['@/views/cloud/projectmanage/AddCloudSystem'], resolve),
        name: 'AddCloudSystems',
        meta: { title: '申请项目' }
      }
    ]
  },
  {
    path: '/clouds',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'CloudSystemDetails/:Id',
        component: (resolve) => require(['@/views/cloud/CloudSystemDetails'], resolve),
        name: 'CloudSystemDetail',
        meta: { title: '上云系统详情' }
      }
    ]
  },
  {
    path: '/clouds/cloudapply',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'CloudSystemDetails/:Id',
        component: (resolve) => require(['@/views/cloud/cloudapply/CloudSystemDetails'], resolve),
        name: 'CloudSystemDetails',
        meta: { title: '申请上云系统清单确认' }
      },
      {
        path: 'NotCloudSystemDetails/:Id',
        component: (resolve) => require(['@/views/cloud/cloudapply/NotCloudSystemDetails'], resolve),
        name: 'NotCloudSystemDetails',
        meta: { title: '申请上云系统详情' }
      }
    ]
  },
  {
    path: '/todoItem/todoS',
    component: Layout,
    hidden: true,
    meta: {
      keepAlive: false // 不需要被缓存
    },
    children: [
      {
        path: 'DetailsAgency',
        component: (resolve) => require(['@/views/todoItem/todo/DetailsAgency'], resolve),
        name: 'DetailsAgency',
        meta: { title: '信创资源申请待办详情', keepAlive: false }
      },
      {
        path: 'DetailsAgencyNoXc',
        component: (resolve) => require(['@/views/todoItem/todo/DetailsAgencyNoXc'], resolve),
        name: 'DetailsAgencyNoXc',
        meta: { title: '非信创资源申请待办详情', keepAlive: false }
      },
      {
        path: 'ChangeDetailsAgencyNoXc',
        component: (resolve) => require(['@/views/todoItem/todo/ChangeDetailsAgencyNoXc'], resolve),
        name: 'ChangeDetailsAgencyNoXc',
        meta: { title: '非信创资源变更待办详情', keepAlive: false }
      },
      {
        path: 'ChangeDetailsAgency',
        component: (resolve) => require(['@/views/todoItem/todo/ChangeDetailsAgency'], resolve),
        name: 'ChangeDetailsAgency',
        meta: { title: '信创资源变更待办详情', keepAlive: false }
      }
    ]
  },
  {
    path: '/resources/changes',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'add',
        component: (resolve) => require(['@/views/resources/change/add'], resolve),
        name: 'add',
        meta: { title: '信创资源变更' }
      }
    ]
  },
  {
    path: '/resources/changeNoXc',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'add',
        component: (resolve) => require(['@/views/resources/changeNoXc/add'], resolve),
        name: 'changeNoXc',
        meta: { title: '非信创资源变更' }
      }
    ]
  },
  {
    path: '/resources/changes',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'detail/:id',
        component: (resolve) => require(['@/views/resources/change/detail'], resolve),
        name: 'detail',
        meta: { title: '信创资源变更详情' }
      },
      {
        path: 'detailNoXc/:id',
        component: (resolve) => require(['@/views/resources/changeNoXc/detail'], resolve),
        name: 'detailNoXc',
        meta: { title: '非信创资源变更详情' }
      }
    ]
  },
  {
    path: '/resources/IPResourceManagers',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/resources/IPResourceManager/details'], resolve),
        name: 'IPResourceManagersdetails',
        meta: { title: 'IP资源管理待办详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/resources/IPResourceManager/Donedetails'], resolve),
        name: 'IPResourceManagersDonedetails',
        meta: { title: 'IP资源管理已办详情' }
      }
    ]
  },
  {
    path: '/faultdeclara/ApplicationFailures',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/faultdeclara/ApplicationFailure/details'], resolve),
        name: 'ApplicationFailuresdetails',
        meta: { title: '应用故障待办详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/faultdeclara/ApplicationFailure/Donedetails'], resolve),
        name: 'ApplicationFailuresDonedetails',
        meta: { title: '应用故障已办详情' }
      },
    ]
  },
  {
    path: '/faultdeclara/systemFailures',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/faultdeclara/systemFailure/details'], resolve),
        name: 'systemFailuresdetails',
        meta: { title: '操作系统故障待办详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/faultdeclara/systemFailure/Donedetails'], resolve),
        name: 'systemFailuresDonedetails',
        meta: { title: '操作系统故障已办详情' }
      }
    ]
  },
  {
    path: '/faultdeclara/NetworkFailures',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/faultdeclara/NetworkFailure/details'], resolve),
        name: 'NetworkFailuresdetails',
        meta: { title: '网络故障待办详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/faultdeclara/NetworkFailure/Donedetails'], resolve),
        name: 'NetworkFailuresDonedetails',
        meta: { title: '网络故障已办详情' }
      }
    ]
  },
  {
    path: '/faultdeclara/CloudFailures',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/faultdeclara/CloudFailure/details'], resolve),
        name: 'CloudFailuresdetails',
        meta: { title: '云平台待办详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/faultdeclara/CloudFailure/Donedetails'], resolve),
        name: 'CloudFailuresDonedetails',
        meta: { title: '云平台已办详情' }
      }
    ]
  },
  {
    path: '/faultdeclara/SafetyFailures',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/faultdeclara/SafetyFailure/details'], resolve),
        name: 'SafetyFailuresdetails',
        meta: { title: '安全故障待办详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/faultdeclara/SafetyFailure/Donedetails'], resolve),
        name: 'SafetyFailuresDonedetails',
        meta: { title: '安全故障已办详情' }
      }
    ]
  },
  {
    path: '/businessassistance/ArrayInteractions',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/ArrayInteraction/details'], resolve),
        name: 'ArrayInteractionsdetails',
        meta: { title: '数据交互详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/ArrayInteraction/Donedetails'], resolve),
        name: 'ArrayInteractionsDonedetails',
        meta: { title: '数据交互已办详情' }
      }
    ]
  },
  {
    path: '/businessassistance/InterfaceManagements',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/InterfaceManagement/details'], resolve),
        name: 'InterfaceManagementsdetails',
        meta: { title: '端口管理详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/InterfaceManagement/Donedetails'], resolve),
        name: 'InterfaceManagementsDonedetails',
        meta: { title: '端口管理详情' }
      }
    ]
  },
  {
    path: '/businessassistance/AccessRightss',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/AccessRights/details'], resolve),
        name: 'AccessRightssdetails',
        meta: { title: '访问权限详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/AccessRights/Donedetails'], resolve),
        name: 'AccessRightssDonedetails',
        meta: { title: '访问权限详情' }
      }
    ]
  },
  {
    path: '/businessassistance/InOutComputerRooms',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/InOutComputerRoom/details'], resolve),
        name: 'InOutComputerRoomsdetails',
        meta: { title: '进出机房详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/InOutComputerRoom/Donedetails'], resolve),
        name: 'InOutComputerRoomsDonedetails',
        meta: { title: '进出机房详情' }
      }
    ]
  },
  {
    path: '/businessassistance/SystemUpgrades',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/SystemUpgrade/details'], resolve),
        name: 'SystemUpgradesdetails',
        meta: { title: '系统升级/变更详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/SystemUpgrade/Donedetails'], resolve),
        name: 'SystemUpgradesDonedetails',
        meta: { title: '系统升级/变更详情' }
      }
    ]
  },
  {
    path: '/businessassistance/ManagedDevices',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/ManagedDevice/details'], resolve),
        name: 'ManagedDevicesdetails',
        meta: { title: '托管设备上下架详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/ManagedDevice/Donedetails'], resolve),
        name: 'ManagedDevicesDonedetails',
        meta: { title: '托管设备上下架详情' }
      }
    ]
  },
  {
    path: '/businessassistance/PressureSafetyTests',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/PressureSafetyTest/details'], resolve),
        name: 'PressureSafetyTestsdetails',
        meta: { title: '压力/安全测试详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/PressureSafetyTest/Donedetails'], resolve),
        name: 'PressureSafetyTestsDonedetails',
        meta: { title: '压力/安全测试详情' }
      }
    ]
  },
  {
    path: '/businessassistance/DomainNameFilings',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/DomainNameFiling/details'], resolve),
        name: 'DomainNameFilingsdetails',
        meta: { title: '域名备案详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/DomainNameFiling/Donedetails'], resolve),
        name: 'DomainNameFilingsDonedetails',
        meta: { title: '域名备案详情' }
      }
    ]
  },
  {
    path: '/businessassistance/RetrieveRecordPasswords',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/RetrieveRecordPassword/details'], resolve),
        name: 'RetrieveRecordPasswordsdetails',
        meta: { title: '找回备案号密码详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/RetrieveRecordPassword/Donedetails'], resolve),
        name: 'RetrieveRecordPasswordsDonedetails',
        meta: { title: '找回备案号密码详情' }
      }
    ]
  },
  {
    path: '/businessassistance/OtherMatterss',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'details',
        component: (resolve) => require(['@/views/businessassistance/OtherMatters/details'], resolve),
        name: 'OtherMatterssdetails',
        meta: { title: '其他事项详情' }
      },
      {
        path: 'Donedetails',
        component: (resolve) => require(['@/views/businessassistance/OtherMatters/Donedetails'], resolve),
        name: 'OtherMatterssDonedetails',
        meta: { title: '其他事项详情' }
      }
    ]
  },
  {
    path: '/todoItem/dones',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'applyDetails',
        component: (resolve) => require(['@/views/todoItem/done/applyDetails'], resolve),
        name: 'applyDetails',
        meta: { title: '已办信创资源申请详情' }
      },
      {
        path: 'applyDetailsNoXc',
        component: (resolve) => require(['@/views/todoItem/done/applyDetailsNoXc'], resolve),
        name: 'applyDetailsNoXc',
        meta: { title: '已办非信创资源申请详情' }
      },
      {
        path: 'ChangeapplyDetails',
        component: (resolve) => require(['@/views/todoItem/done/ChangeapplyDetails'], resolve),
        name: 'ChangeapplyDetails',
        meta: { title: '已办信创资源变更详情' }
      },
      {
        path: 'ChangeapplyDetailsNoXc',
        component: (resolve) => require(['@/views/todoItem/done/ChangeapplyDetailsNoXc'], resolve),
        name: 'ChangeapplyDetailsNoXc',
        meta: { title: '已办非信创资源变更详情' }
      }
    ]
  },
]

export default new Router({
  // mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
